if "Cancel" is not in it and "Error" is not in it then
show card field 1
set the visible of card button 2 to true
end if
end mouseUp
-- part 2 (field)
-- low flags: 81
-- high flags: 2007
-- rect: left=265 top=33 right=296 bottom=486
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 20
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: FileToField Text
-- part 3 (button)
-- low flags: 80
-- high flags: A003
-- rect: left=284 top=268 right=290 bottom=458
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Empty and Hide this Field
----- HyperTalk script -----
on mouseUp
set lockscreen to true
put empty into card field 1
hide card field 1
set the visible of me to false
-- doMenu "Compact Stack"
set lockscreen to false
end mouseUp
-- part 6 (field)
-- low flags: 81
-- high flags: 2007
-- rect: left=12 top=26 right=298 bottom=491
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 22
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Source
-- part 8 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=299 top=300 right=322 bottom=438
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Show Pascal Source
----- HyperTalk script -----
on mouseUp
set the visible of card field 2 to not the visible of card field 2
if the visible of card field 2 is true then
set the name of me to "Hide Pascal Source"
else set the name of me to "Show Pascal Source"
end mouseUp
-- part contents for background part 16
----- text -----
FILETOFIELD XCMD version 1.5
Kevin Calhoun
The FileToField XCMD copies the contents of a text file into a HyperCard field. You may choose the text file to copy from by selecting it from a standard file dialog box or by specifying its full pathname.
If the text file is too large (just under 30K is the practical limit for HyperCard fields), FileToField won't try to copy it into the field. If this or any other error occurs, FileToField will return an error message as the result. Word 1 of this message will be "Error". If the text was copied successfully, FileToField returns the full pathname of the file as the result.
INVOKING FILETOFIELD
FileToField "fieldDesignation",<"full pathname of file">
You may designate the field into which the text is to be copied in any way considered valid by HyperCard, by number, id, or name, with one exception: you can't use the field's name if it is more than one word. If you do use the field's name, don't put the field name in quotation marks. Nested quotations confuse HyperCard. (See the examples below.)
If you don't supply the pathname of the file to be copied from, FileToField will invoke SFGetFile, and the user can select the file from the dialog box. If the user pushes the cancel button of the dialog box, FileToField returns "Cancel" as the Result.
examples--
FileToField("card field 1") --these examples copy files chosen from the
FileToField("bkgnd field id 16") --standard file dialog into the specified field
FileToField("card field Memorex")
FileToField "field 5","OldAchesAndPains:Good Stuff:Secrets" --this copies the file
"Secrets" into background field 5.
REVISION HISTORY
7 March 1988: release of version 1.0
31 March 1988: release of version 1.1
--better reporting of memory errors
--more compact code
16 May 1988: release of version 1.2
-- fixed bug that bombed Mac Plus (switched from PBHOpen to FSOpen)
15 March 1989 -- 1.5
-- Altered source code for compatibility with MPW Pascal 3.0.
-- part contents for card part 6
----- text -----
UNIT FileToFieldUnit;
{ FileToField XCMD © 1988-1989 by the Trustees of Dartmouth College }